#ifndef __AUDIO_RENDER_H__
#define __AUDIO_RENDER_H__

extern "C" {
#include <libavcodec/avcodec.h>
#include <SDL2/SDL.h>
}

#include "render.h"
#include "threadsafe_ringbuffer.h"

namespace dpl {

class AudioRender
{
public:
    AudioRender();
    virtual ~AudioRender();

    virtual int OpenAudio(const AVCodecParameters &param);

    virtual int Enqueue(AVFrame* frame, std::chrono::milliseconds wait_dur);
    virtual int Clear();

    virtual int FillAudio(uint8_t* stream int len);

    virtual int StartRender();
    virtual int StopRender();
    virtual int TogglePause();

private:
    threadsafe_ringbuffer<char> buffer_;
    SDL_AudioSpec audio_spec_;
    int paused_;
};

}

#endif // __AUDIO_RENDER_H__